<div id="page-wrapper">
	<div class="row">
		<div class="col-lg-12">
			<div class="panel panel-default margin-vertical-default">
				<div class="panel-heading margint-top-default">
					<h3 class="no-margin">
						<span>{$data['id']}号作品</span>
						<a type="reset" href="javascript:history.go(-1);" class="btn btn-default btn-align-right">返回</a>
						<div class="clearfix"></div>
					</h3>
				</div>
				<div class="panel-body">
					<div class="row">
						<div class="col-lg-8">
							<!-- {{Form::open(array('url'=>'super/show/save', 'files'=>true, 'method' => 'post'))}}-->
							<form action="{:U('User/praiseeat/item_update')}" method="POST">
								<input type='hidden' name='item' value="{$data['id']}">
								<input type='hidden' name="praise" value="{$data['praise_id']}" >
								<div class="form-group">
									<label>作品图片</label>
									<div class="thumbnail placedRelative">
										<img src="{$data['pic']}">
										<input type="hidden" name="pic" value="{$data['pic']}">
									</div>
								</div>

								<div class="form-group">
									<label>作品名称</label>
									<input class="form-control safe-edit" readonly="true" name='show_name' value="{$data['show_name']}">
								</div>

								<div class="form-group">
									<label>创作说明</label>
									<textarea class="form-control safe-edit" readonly="true" rows="3" name='contract'>{$data['contract']}</textarea>
								</div>

								<div class="form-group">
									<label>作者姓名</label>
									<input class="form-control safe-edit" readonly="true" name='author_name' value="{$data['author_name']}">
								</div>

                                <!--<div class="form-group">
									<label>出生年月</label>
									<input class="form-control date-picker safe-edit" readonly="true" name='birth_time' value="{$data['birth_time']}">
                                </div>

								<div class="form-group">
									<label>年龄</label>
									<input class="form-control" value="<php>$birth = getdate( strtotime( $data['birth_time'] ) ); $now = getdate();echo ceil( $now['year'] - $birth['year'] );</php>">
								</div>

								<div class="form-group">
									<label>身份证号</label>
									<input class="form-control safe-edit" readonly="true" name='idcard' value="{$data['card']}">
                                </div> -->

								<div class="form-group">
									<label>年龄证明</label>
									<div class="thumbnail placedRelative">
										<img src="{$data['birth_file']}">
										<input type='hidden' name='birth_file' value="{$data['birth_file']}" >
									</div>
								</div>
								<div class="form-group">
									<label>学校</label>
									<input class="form-control safe-edit" readonly="true" name='school_name' value="{$data['school_name']}">
								</div>
                                <!--<div class="form-group">
									<label>年级</label>
									<input class="form-control safe-edit" readonly="true" name='grade' value="{$data['grade']}">
                                </div> -->
								<div class="form-group">
									<label>行政区属</label>
									<!-- <select id="seachprov" name="seachprov" onchange="changeComplexProvince(this.value, sub_array, 'seachcity', 'seachdistrict');loadCity({$data['city']})" class="areaSelect"></select>
									<select id="seachcity" name="homecity" onchange="changeCity(this.value,'seachdistrict','seachdistrict')" class="areaSelect"></select>
									<select id="seachdistrict" data-validate="requireSelects" name="seachdistrict" class="areaSelect"></select> -->
									<select class="provience safe-edit" readonly="true" name="provience">
                                        <option value="0">请选择</option>
									</select>

									<select class="city safe-edit" readonly="true" name="city">
                                        <option value="0">请选择</option>
									</select>

									<select class="region safe-edit" readonly="true" name="region">
                                        <option value="0">请选择</option>
									</select>

                                    <!--<input class="form-control safe-edit" readonly="true" name="address" value="{$data['address']}"> -->
								</div>
								<div class="form-group">
									<label>教师姓名</label>
									<input class="form-control safe-edit" readonly="true" name='teacher_name' value="{$data['teacher_name']}">
								</div>
								<div class="form-group">
									<label>教师电话</label>
									<input class="form-control safe-edit" readonly="true" name='teacher_telephone' value="{$data['teacher_telephone']}">
								</div>

                                <notempty name="data.author_pic">
                                <div class="form-group">
                                <label>作者图片</label>
									<div class="thumbnail placedRelative">
										<img src="{$data['author_pic']}">
										<input type="hidden" name="author_pic" value="{$data['author_pic']}">
									</div>
                                </div>
                                </notempty>

                                <notempty name="data.author_contract">
                                <div class="form-group">
									<label>作者介绍</label>
									<textarea class="form-control safe-edit" readonly="true" rows="3" name='contract'>{$data['author_contract']}</textarea>
								</div>
                                </notempty>

                                <notempty name="data.teacher_pic">
                                <div class="form-group">
                                <label>教师图片</label>
									<div class="thumbnail placedRelative">
										<img src="{$data['teacher_pic']}">
										<input type="hidden" name="teacher_pic" value="{$data['teacher_pic']}">
									</div>
                                </div>
                                </notempty>

                                <notempty name="data.teacher_contract">
                                <div class="form-group">
									<label>教师介绍</label>
									<textarea class="form-control safe-edit" readonly="true" rows="3" name='contract'>{$data['teacher_contract']}</textarea>
								</div>
                                </notempty>

                                <notempty name="data.school_pic">
                                <div class="form-group">
                                <label>学校图片</label>
									<div class="thumbnail placedRelative">
										<img src="{$data['school_pic']}">
										<input type="hidden" name="school_pic" value="{$data['school_pic']}">
									</div>
                                </div>
                                </notempty>

                                <notempty name="data.school_contract">
                                <div class="form-group">
									<label>学校介绍</label>
									<textarea class="form-control safe-edit" readonly="true" rows="3" name='contract'>{$data['school_contract']}</textarea>
								</div>
                                </notempty>

								<div class="form-group">
									<label>支持服务队</label>
									<select name="support_team" class="form-control safe-edit" readonly="true">
                                        <option value="0">其他</option>
										<foreach name="teams" item="team">
											<option value="{$team['id']}" <if condition="$team['id'] eq $data['support_team']">selected</if> >{$team['name']}</option>
										</foreach>
									</select>
									<!-- <input class="form-control" name='support_team' value="{$data['support_team']}"> -->
								</div>
								<div class="form-group">
									<label>审核状态</label>
									<select name="status" class="form-control">
										<option value="0" <if condition="$data['status'] eq 0">selected</if> >未审核</option>
										<option value="1" <if condition="$data['status'] eq 1" >selected</if>>审核通过</option>
										<option value="-1" <if condition="$data['status'] eq -1">selected</if>>审核退回</option>
									</select>
								</div>
								<div class="form-group">
									<label>备注</label>
									<input class="form-control" name='yuliu' value="{$data['yuliu']}">
								</div>
								<div class="form-group">
									<label>退回原因</label>
									<input class="form-control" name='yuliu2' value="{$data['yuliu2']}">
								</div>
								<button type="submit" class="btn btn-default">保  存</button>
							</form>
							<!-- {{Form::close()}} -->
						</div>

					</div>
					<!-- /.row (nested) -->
				</div>
				<!-- /.panel-body -->
			</div>
			<!-- /.panel -->
		</div>
		<!-- /.col-lg-12 -->
	</div>
	<!-- /.row -->
</div>
<!-- <script type="text/javascript" src="/Public/js/area.js"></script> -->
<script type="text/javascript" src="/Public/js/laydate/laydate.js"></script>
<script type="text/javascript" src="/Public/zjdailyCard/js/offline.china.js"></script>
<script type="text/javascript">
	$( ".date-picker" ).bind( "click", function(){
	laydate( {
    	format: 'YYYY/MM/DD hh:mm:ss',
    	// min: laydate.now(), //设定最小日期为当前日期
    	max: '2099-06-16 23:59:59', //最大日期
    	istime: true,
    	istoday: false,
    	//choose: function(datas){
         //end.min = datas; //开始日选好后，重置结束日的最小日期
         //end.start = datas //将结束日的初始值设定为开始日
    	//}
		} ); 
		laydate.skin( "molv" );
	} );
	$( ".safe-edit" ).unbind( "blur" ).bind( "blur", function(){
		$( this ).attr( "readonly", true );
	} );
	$(".safe-edit").unbind( "dblclick" ).bind( "dblclick", function(){
		$( this ).attr( "readonly", false );
		// console.log("ddd");
	});
</script>
<script type="text/javascript">
	var miniCity = ( function(){
		var _provience = undefined;
		var _city = undefined;
		var _region = undefined;

		var _changeProvience = function( code ){
			!code && ( code = $(this).val() );
			var options = undefined;
            /*(code > 0) && $.get( '/?m=user&c=miniCity&a=check', { code: code }, function(result){
				options = "<option value=0>请选择</option>";
				for( var i in result.sons ){
					options += "<option value="+result.sons[i].id+">"+result.sons[i].regionname + "</option>";
				}
				//_provience.html( "" );
				_city.html("");
				//_provience.append( $( "<option value="+result.parent.id+">" + result.parent.regionname + "</option>") );
				_city.append( $(options) ).trigger( "change" );
			} );*/
            if( code > 0 ){
				options = "<option value=0>请选择</option>";
                for( var i in offline.china.cities[code] ){
                    options += "<option value="+i+">"+ offline.china.cities[code][i] + "</option>";
                }
                _city.html("");
                _city.append( $(options) ).trigger( "change" );
            }
            (code == 0) && _city.html( "<option value=0>请选择</option>" ).trigger("change");
		};
		var _changeCity = function( code, region ){
			!code && ( code = $(this).val() );
            /*( code > 0 ) && $.get( '/?m=user&c=miniCity&a=check', { code: code }, function(result){
				options = "<option value=0>请选择</option>";
				for( var i in result.sons ){
					options += "<option value="+result.sons[i].id+">"+result.sons[i].regionname + "</option>";
				}
				_region.html("");
				_city.find( "option[value=" + code + "]" ).attr( 'selected', true );
				_region.append( $(options) );
				region && _region.find( "option[value=" + region + "]" ).attr( "selected", true );
			} );*/
            if( code > 0 ){
                options = "<option value=0>请选择</option>";
                for( var i in offline.china.counties[code] ){
                    options += "<option value="+i+">"+offline.china.counties[code][i] + "</option>";
                }
                _region.html("");
                _city.find( "option[value=" + code + "]" ).attr( 'selected', true );
                _region.append( $(options) );
                region && _region.find( "option[value=" + region + "]" ).attr( "selected", true );
            }
            ( code == 0) &&  _region.html("<option value=0>请选择</option>").trigger( "change" );
		};
		var changeRegion = function( code ){
		};

        var _initProvience = function( code, selected ){
            /*$.post( '/?m=user&c=miniCity&a=checks', {codes: code}, function( result ){
                 var options = "<option value=0>请选择</option>";
                 for( var i in result ){
                    options += "<option value=" + result[i].id + ">" + result[i].regionname + "</option>"
                 }
                 _provience.html( "" );
                 _provience.html( options );
                 _provience.find( "option[value="+selected+"]" ).attr( "selected", true );
            } );*/

            var options = "<option value=0>请选择</option>";
            for( var i in code ){
                options += "<option value=" + code[i] + ">" + offline.china.provinces[code[i]] + "</option>"
            }
            _provience.html( "" );
            _provience.html( options );
            _provience.find( "option[value="+selected+"]" ).attr( "selected", true );
        }
		return {
			init: function( s_provience, s_city, s_region, provience, city, region ){
				_provience = $( s_provience );
				_city = $( s_city );
				_region = $( s_region );

                _initProvience( [31, 25], provience );
				provience && _changeProvience( provience );
				city && _changeCity( city, region );

                _provience.bind( "change", function(){
                        _changeProvience( $(this).val() );
                } );
                
				_city.bind( "change", function(){
					_changeCity( $(this).val() );
				} );
			},
			//changeCity: _changeCity
		}
	})();
miniCity.init( ".provience", ".city", ".region", "{$data['provience']}", "{$data['city']}", "{$data['region']}" );
</script>
